<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="android,code," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="基于ShortcutBadger实现 The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!    ShortcutBadger使用 主要实现badge生成和消除功能。  一般badge会配合Notifaction使用，故而在生成Noti">
<meta name="keywords" content="android,code">
<meta property="og:type" content="article">
<meta property="og:title" content="Android桌面图标实现">
<meta property="og:url" content="http://yoursite.com/2017/03/17/android/Android桌面图标实现/index.html">
<meta property="og:site_name" content="The Old Man and the Sea">
<meta property="og:description" content="基于ShortcutBadger实现 The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!    ShortcutBadger使用 主要实现badge生成和消除功能。  一般badge会配合Notifaction使用，故而在生成Noti">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://upload-images.jianshu.io/upload_images/759172-2b36d5b0302a4a12.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">
<meta property="og:updated_time" content="2017-08-09T10:11:16.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Android桌面图标实现">
<meta name="twitter:description" content="基于ShortcutBadger实现 The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!    ShortcutBadger使用 主要实现badge生成和消除功能。  一般badge会配合Notifaction使用，故而在生成Noti">
<meta name="twitter:image" content="http://upload-images.jianshu.io/upload_images/759172-2b36d5b0302a4a12.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/03/17/android/Android桌面图标实现/"/>





  <title>Android桌面图标实现 | The Old Man and the Sea</title>
  














</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">The Old Man and the Sea</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">But man is not made for defeat. A man can be destroyed but not defeated.</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/03/17/android/Android桌面图标实现/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Ernest Chang">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/images/avert.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="The Old Man and the Sea">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Android桌面图标实现</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-03-17T11:15:43+08:00">
                2017-03-17
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/android/" itemprop="url" rel="index">
                    <span itemprop="name">android</span>
                  </a>
                </span>

                
                
                  ， 
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/android/code/" itemprop="url" rel="index">
                    <span itemprop="name">code</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="基于ShortcutBadger实现"><a href="#基于ShortcutBadger实现" class="headerlink" title="基于ShortcutBadger实现"></a>基于<a href="https://github.com/leolin310148/ShortcutBadger" target="_blank" rel="external">ShortcutBadger</a>实现</h3><blockquote>
<p>The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut!</p>
</blockquote>
<p> <img src="http://upload-images.jianshu.io/upload_images/759172-2b36d5b0302a4a12.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="img"></p>
<h3 id="ShortcutBadger使用"><a href="#ShortcutBadger使用" class="headerlink" title="ShortcutBadger使用"></a>ShortcutBadger使用</h3><ul>
<li><p>主要实现badge生成和消除功能。</p>
</li>
<li><p>一般badge会配合Notifaction使用，故而在生成Notifaction的地方，调用badge生成方法。</p>
</li>
<li><p>而当App从后台返回前台时，调用badge清除方法。</p>
</li>
</ul>
<h3 id="测试运行效果"><a href="#测试运行效果" class="headerlink" title="测试运行效果"></a>测试运行效果</h3><ul>
<li><p>测试可行厂商</p>
<ul>
<li>华为</li>
<li>三星</li>
</ul>
</li>
<li><p>需调试厂商</p>
<ul>
<li><a href="http://dev.xiaomi.com/doc/p=3904/index.html" target="_blank" rel="external">小米</a><ul>
<li>小米MIUI 6.0开始，发送通知自动生成桌面角标，且默认桌面角标数badge会根据通知ID个数自动累加，点击应用badge自动消失。同时，其提供开放API，可自定义badge个数。</li>
<li>针对小米，在调用端分开处理。</li>
</ul>
</li>
</ul>
</li>
<li><p>未开通桌面图标厂商</p>
<ul>
<li><p>魅族</p>
</li>
<li><p>中兴</p>
</li>
<li><p>酷派</p>
</li>
<li><p>OPPO部分应用开通</p>
</li>
</ul>
</li>
</ul>
<h3 id="最终代码"><a href="#最终代码" class="headerlink" title="最终代码"></a>最终代码</h3><ul>
<li><p>生成Notifaction和Badge时：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div></pre></td><td class="code"><pre><div class="line">  /**</div><div class="line">     * 生成通知和桌面角标</div><div class="line">     */</div><div class="line">    private void setFlowNotifaction(Context context, Intent resultIntent, String title, String msg) &#123;</div><div class="line"></div><div class="line">        mBadge++;</div><div class="line"></div><div class="line">        // 小米miui6.0以后根据通知自动生成badge,根据通知次数自动累加。调用ShortcutBadger会自动生成空通知，需调用以下修改badge</div><div class="line">        if (Build.MANUFACTURER.equalsIgnoreCase(&quot;Xiaomi&quot;) &amp;&amp; Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.JELLY_BEAN) &#123;</div><div class="line">            tryNewMiuiBadge(context, resultIntent, mBadge, title, msg, R.drawable.icon_app);</div><div class="line">        &#125; else &#123;</div><div class="line">            showNotifacitonBadge(context, resultIntent, mBadge, title, msg, R.drawable.icon_app);</div><div class="line">        &#125;</div><div class="line">    &#125;</div><div class="line">    </div><div class="line">    private void showNotifacitonBadge(Context context, Intent resultIntent, int badge, String title, String msg, int drawIcon) &#123;</div><div class="line">        PendingIntent pendingIntent = PendingIntent.getActivity(context,</div><div class="line">                0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);</div><div class="line">        NotificationCompat.Builder mBuilder =</div><div class="line">                new NotificationCompat.Builder(context)</div><div class="line">                        .setSmallIcon(drawIcon)</div><div class="line">                        .setContentTitle(title)</div><div class="line">                        .setContentText(msg)</div><div class="line">                        .setTicker(msg);</div><div class="line">//        mBuilder.setFullScreenIntent(pendingIntent, true);</div><div class="line">        mBuilder.setContentIntent(pendingIntent);</div><div class="line">        mBuilder.setAutoCancel(true);</div><div class="line"></div><div class="line"></div><div class="line">        // 设置通知的优先级</div><div class="line">        mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);</div><div class="line">//        Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);</div><div class="line">//        // 设置通知的提示音</div><div class="line">//        mBuilder.setSound(alarmSound);</div><div class="line">        mBuilder.setDefaults(Notification.DEFAULT_ALL);</div><div class="line"></div><div class="line"></div><div class="line">        int mNotificationId = 10086;</div><div class="line">        NotificationManager mNotifyMgr = (NotificationManager) context</div><div class="line">                .getSystemService(Context.NOTIFICATION_SERVICE);</div><div class="line">        mNotifyMgr.notify(mNotificationId, mBuilder.build());</div><div class="line">        // 生成桌面角标</div><div class="line">        ShortcutBadger.applyCount(JApplication.getInstance(), badge);</div><div class="line">    &#125;</div><div class="line"></div><div class="line">    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)</div><div class="line">    private void tryNewMiuiBadge(Context context, Intent resultIntent, int badgeCount, String title, String msg, int drawIcon) &#123;</div><div class="line"></div><div class="line">        PendingIntent pendingIntent = PendingIntent.getActivity(context,</div><div class="line">                0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);</div><div class="line">        NotificationCompat.Builder mBuilder =</div><div class="line">                new NotificationCompat.Builder(context)</div><div class="line">                        .setSmallIcon(drawIcon)</div><div class="line">                        .setContentTitle(title)</div><div class="line">                        .setContentText(msg)</div><div class="line">                        .setTicker(msg);</div><div class="line">//        mBuilder.setFullScreenIntent(pendingIntent, true);</div><div class="line">        mBuilder.setContentIntent(pendingIntent);</div><div class="line">        mBuilder.setAutoCancel(true);</div><div class="line"></div><div class="line"></div><div class="line">        // 设置通知的优先级</div><div class="line">        mBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);</div><div class="line">//        Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);</div><div class="line">//        // 设置通知的提示音</div><div class="line">//        mBuilder.setSound(alarmSound);</div><div class="line">        mBuilder.setDefaults(Notification.DEFAULT_ALL);</div><div class="line"></div><div class="line"></div><div class="line">//        int mNotificationId = 10086;</div><div class="line">        NotificationManager mNotifyMgr = (NotificationManager) context</div><div class="line">                .getSystemService(Context.NOTIFICATION_SERVICE);</div><div class="line">        Notification notification = mBuilder.build();</div><div class="line"></div><div class="line">        try &#123;</div><div class="line">            Field field = notification.getClass().getDeclaredField(&quot;extraNotification&quot;);</div><div class="line">            Object extraNotification = field.get(notification);</div><div class="line">            Method method = extraNotification.getClass().getDeclaredMethod(&quot;setMessageCount&quot;, int.class);</div><div class="line">            method.invoke(extraNotification, badgeCount);</div><div class="line"></div><div class="line">        &#125; catch (Exception e) &#123;</div><div class="line">            e.printStackTrace();</div><div class="line">        &#125;</div><div class="line"></div><div class="line">        mNotifyMgr.notify(0, notification);</div><div class="line">    &#125;</div></pre></td></tr></table></figure>
<p>​</p>
</li>
<li><p>消除Badge时：</p>
<blockquote>
<p>App从后台返回前台都需要清除badge，故而现在Activity基类中做统一检测处理</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div></pre></td><td class="code"><pre><div class="line">@Override</div><div class="line"> protected void onResume() &#123;</div><div class="line">     super.onResume();</div><div class="line">     MobclickAgent.onResume(this);</div><div class="line"></div><div class="line">     // 小米miui6.0后，会自动清除badge，调用ShortcutBadger会自动生成空通知</div><div class="line">     if (mBadge &gt; 0) &#123;</div><div class="line">         if (Build.MANUFACTURER.equalsIgnoreCase(&quot;Xiaomi&quot;) &amp;&amp; Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.JELLY_BEAN) &#123;</div><div class="line">             mBadge = 0;</div><div class="line"></div><div class="line">         &#125; else &#123;</div><div class="line">             mBadge = 0;</div><div class="line">             ShortcutBadger.applyCount(this, 0);</div><div class="line">         &#125;</div><div class="line">     &#125;</div><div class="line"> &#125;</div></pre></td></tr></table></figure></li>
</ul>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>Donate</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/uploads/images/wxpay.png" alt="Ernest Chang WeChat Pay"/>
        <p>WeChat Pay</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/uploads/images/alipay.png" alt="Ernest Chang Alipay"/>
        <p>Alipay</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/android/" rel="tag"># android</a>
          
            <a href="/tags/code/" rel="tag"># code</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/03/15/android/《Android开发艺术探索》Chap3_View的事件体系/" rel="next" title="《Android开发艺术探索》Chap3_View的事件体系">
                <i class="fa fa-chevron-left"></i> 《Android开发艺术探索》Chap3_View的事件体系
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/03/21/android/CharSequence/" rel="prev" title="类似网页超链接实现">
                类似网页超链接实现 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/images/avert.png"
               alt="Ernest Chang" />
          <p class="site-author-name" itemprop="name">Ernest Chang</p>
           
              <p class="site-description motion-element" itemprop="description">All any predator can do is to keep on trying.</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives/">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">8</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">5</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Links
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.jianshu.com/u/9b7137da7356" title="Ernest的简书" target="_blank">Ernest的简书</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#基于ShortcutBadger实现"><span class="nav-number">1.</span> <span class="nav-text">基于ShortcutBadger实现</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#ShortcutBadger使用"><span class="nav-number">2.</span> <span class="nav-text">ShortcutBadger使用</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#测试运行效果"><span class="nav-number">3.</span> <span class="nav-text">测试运行效果</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#最终代码"><span class="nav-number">4.</span> <span class="nav-text">最终代码</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Ernest Chang</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  






  





  

  

  

  

  

  

</body>
</html>
